<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('支付单列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>[[#{transactionNumber}]]：</label>
                                <input type="text" name="paymentNo"/>
                            </li>
                            <li>
                                <label>[[#{orderNo}]]：</label>
                                <input type="text" name="orderNo"/>
                            </li>
                            <li>
                                <label>[[#{paymentMethod}]]：</label>
                                <select name="paymentMethod">
                                    <option value="">[[#{all}]]</option>
                                    <option value="1">线下支付</option>
                                    <option value="2">微信支付</option>
                                </select>
                            </li>
                            <li>
                                <label>[[#{paymentStatus}]]：</label>
                                <select name="paymentStatus">
                                    <option value="">[[#{all}]]</option>
                                    <option value="1">待支付</option>
                                    <option value="2">已支付</option>
                                    <option value="3">支付取消</option>
                                    <option value="4">支付异常</option>
                                </select>
                            </li>
                            <li>
                                <label>[[#{paymentTime}]]：</label>
                                <input type="text" class="time-input" id="beginPayTime" th:placeholder="#{beginTime}" name="params[beginPayTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endPayTime" th:placeholder="#{endTime}" name="params[endPayTime]" />
                            </li>
                            <li>
                                <label>[[#{createTime}]]：</label>
                                <input type="text" class="time-input" id="beginCreateTime" th:placeholder="#{beginTime}" name="params[beginCreateTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endCreateTime" th:placeholder="#{endTime}" name="params[endCreateTime]" />
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;[[#{search}]]</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;[[#{reset}]]</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:payment:export">
                    <i class="fa fa-download"></i> [[#{export}]]
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "business/payment";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "支付单",
                sortName: "createTime",
                sortOrder: "desc",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'paymentId',
                    title: '支付id',
                    visible: false
                },
                {
                    field: 'orderNo',
                    title: i18n('orderNo')
                },
                {
                    field: 'paymentNo',
                    title: i18n('transactionNumber')
                },
                {
                    field: 'currency',
                    title: i18n('currency')
                },
                {
                    field: 'paymentAmount',
                    title: i18n('paymentAmount')
                },
                {
                    field: 'tradeNo',
                    title: i18n('platformTradeNo')
                },
                {
                    field: 'subject',
                    title: i18n('subject')
                },
                {
                    field: 'paymentMethod',
                    title: i18n('paymentMethod'),
                    formatter: function(value, row, index) {
                        if(value == 1){
                            return "线下支付";
                        } else if(value == 2){
                            return "微信支付";
                        } else {
                            return value;
                        }
                    }
                },
                {
                    field: 'paymentMsg',
                    title: i18n('paymentMsg')
                },
                {
                    field: 'paymentStatus',
                    title: i18n('paymentStatus'),
                    formatter: function(value, row, index) {
                        if(value == 0){
                            return "待支付";
                        } else if(value == 1){
                            return "已支付";
                        } else if(value == 2){
                            return "支付取消";
                        } else if(value == 3){
                            return "支付异常";
                        } else {
                            return value;
                        }
                    }
                },
                {
                    field: 'payTime',
                    title: i18n('paymentTime'),
                    sortable:true
                }]
            };
            $.table.init(options);
        });
    </script>

     <script th:inline="javascript">
         var ROOT = [[${#servletContext.contextPath}]];
         var LANG_COUNTRY = [[${#locale.language+'_'+#locale.country}]];

         //初始化i18n
         $.i18n.properties({
             path: ROOT + '/i18n/',//这里表示访问路径
             name: 'messages',//文件名开头
             language: LANG_COUNTRY,//文件名语言 例如en_US
             mode: 'map'//默认值
         });

         //i18n函数
         function i18n(msgKey) {
             try {
                 return $.i18n.prop(msgKey);
             } catch (e) {
                 return msgKey;
             }
         }
     </script>
</body>
</html>